package fr.esiea.es_inf5042.business;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import android.location.Location;

public class User {

	private int id;
	private String name;
	private List<User> friends;	
	
	public User(int id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public User(int id, String name, List<User> friends, Location location) {
		super();
		this.id = id;
		this.name = name;
		this.friends = friends;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<User> getFriends() {
		return friends;
	}

	public void setFriends(List<User> friends) {
		this.friends = friends;
	}
	
	public void addFriend (User friend){
		if (friends == null)
			friends = new ArrayList<User>();
		this.friends.add(friend);
	}
	
	public List<String> getFriendsArrayList() {
		List<String> friendsString = new ArrayList<String>();
		if(friends != null && !friends.isEmpty())
		{
			Iterator<User> i=friends.iterator();
			while(i.hasNext())
				friendsString.add(i.next().getName());
				// friendsString.add(i.next().getId());
			return friendsString;
		} else		
			return null;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
}
